﻿@* 
Project: Aguafrommars/TheIdServer
Copyright (c) 2022 @Olivier Lefebvre
*@
@using Microsoft.AspNetCore.Identity
@using Aguacongas.TheIdServer.Models
@inject IViewLocalizer Localizer

@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager

@if (SignInManager.IsSignedIn(User))
{
    <form asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Page("/Index", new { area = "" })" method="post" id="logoutForm" class="navbar-right">
        <ul class="nav navbar-nav navbar-right">
            <li class="nav-item">
                <a asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">@Localizer["Hello {0}!", UserManager.GetUserName(User)]</a>
            </li>
            <li class="nav-item">
                <button type="submit" class="btn btn-link navbar-btn navbar-link">@Localizer["Logout"]</button>
            </li>
        </ul>
    </form>
}
else
{
    <ul class="nav navbar-nav navbar-right">
        <li class="nav-item"><a asp-area="Identity" asp-page="/Account/Register">@Localizer["Register"]</a></li>
        <li class="nav-item"><a asp-area="Identity" asp-page="/Account/Login">@Localizer["Login"]</a></li>
    </ul>
}
